﻿using Microsoft.AspNetCore.Mvc;
using MPACorePhoneBook.Controllers;
using MPACorePhoneBook.PhoneBooks;
using MPACorePhoneBook.PhoneBooks.Dto;
using System.Threading.Tasks;

namespace MPACorePhoneBook.Web.Mvc.Controllers
{
    public class PersonsController : MPACorePhoneBookControllerBase
    {
        private readonly IPersonAppService _personAppService;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="personAppService"></param>
        public PersonsController(IPersonAppService personAppService)
        {
            this._personAppService = personAppService;
        }

        public async Task<IActionResult> Index(GetPersonInput input)
        {
            var dtos = await this._personAppService.GetPagedPersonAsync(input);
            return View(dtos);
        }
    }
}